Remove setRotationCenter API #581
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Resolves
A step on the long-ish path towards fixing #550
Also a step towards fixing #570
Proposed Changes
This PR removes the API for setting a drawable's rotation center and the
Skin.setRotationCenter
function.It does not remove the API for setting a skin's rotation center when setting its contents.
To fix unit tests which previously called
Skin.setRotationCenter
, it also adds arotationCenter
setter (plus corresponding getter) toMockSkin
, which the unit tests now use.I'm not expecting this to be merged right away--in case scratchfoundation/scratch-vm#2314 causes any regressions in the near future, it'll probably be beneficial to be able to revert that without having to re-add the rotation center API here as well.
Reason for Changes
In order to fix (no, GitHub, it doesn't close) #550, vector costumes' SVG viewboxes must depend on their rotation centers. Every time the viewbox of an SVG is set, its
<img>
must be updated as well, which is a fundamentally asynchronous operation.As such, a synchronous API for setting a skin's rotation center after the skin is loaded is incompatible with the changes necessary for #550.
With scratchfoundation/scratch-vm#2314 merged, that synchronous API is no longer used and can be removed.